The present invention relates to an automatic programming apparatus which is used with a numerically controlled machine having plural spindles. The machine is loaded with a program that permits a work to be machined using two spindles and to be transferred between the two spindles. The automatic programming apparatus is part of a numerically controlled machine tool designed to be loaded with a program which expresses the machined shape of the work and the movement of the tool. When such a program is loaded into a CPU, the CPU automatically calculates the path to be followed by the tool and delivers control media to the NC machine.